#ifndef __WIZ_BNF_PARSER_SEQUENCE_HPP__SHANHAOBO_19800429__
#define __WIZ_BNF_PARSER_SEQUENCE_HPP__SHANHAOBO_19800429__

#include "./WizBNFParserBinary.hpp"

namespace Wiz
{
    namespace BNF
    {
        namespace Parser
        {
            namespace Sequence
            {
                template <typename LeftT, typename RightT>
                struct Type : public ::Wiz::BNF::Parser::Binary::Type<LeftT, RightT, ::Wiz::BNF::Parser::Type<Type<LeftT, RightT>>>
                {
                    typedef Type<LeftT, RightT>                                                                 tThis;
                    typedef ::Wiz::BNF::Parser::Binary::Type<LeftT, RightT, ::Wiz::BNF::Parser::Type<tThis>>    tSuper;

                    Type(LeftT const& Lft, RightT const& Rght) : tSuper(Lft, Rght)
                    {}

                    template <typename ScannerT>
                    typename ::Wiz::BNF::Parser::Result<tThis, ScannerT>::tType
                    ParseImpl(ScannerT const& Scan) const
                    {
                        typedef typename ::Wiz::BNF::Parser::Result<tThis, ScannerT>::tType tResult;
                        tResult RsltLft = this->Left().Parse(Scan);
                        if (RsltLft.IsValid())
                        {
                            tResult RsltRght = this->Right().Parse(Scan);
                            if (RsltRght.IsValid())
                            {
                                Scan.ConcatMatch(RsltLft, RsltRght);
                                return RsltLft;
                            }
                        }
                        return Scan.NoMatch();
                    }
                }; /// end of struct Type
            } /// end of namespace Sequence
        } /// end of namespace Parser
    } /// end of namespace BNF
} /// end of namespace Wiz

#endif /*__WIZ_BNF_PARSER_SEQUENCE_HPP__SHANHAOBO_19800429__*/
